<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">

<script src="javascript/map/maps.js" type="text/javascript"></script>
<script src="javascript/map/main.js" type="text/javascript"></script>
<style type="text/css">
@media print{.gmnoprint{display:none}}
@media screen{.gmnoscreen{display:none}}
#gmaptr a{filter:alpha(opacity=60);opacity:0.6;}
#gmaptr a:hover{filter:alpha(opacity=100);opacity:1.0;}
</style>
</head>

<body style="margin: 0px;">
<div id="map" style="left: 0px; width: 100%; float:left; top: 0px; height: 100%;"></div>
<div id="gmaptr" style="float:right; top:0px; position: absolute; left:50px;">
<form method="post" onsubmit="return checkForm(this)">
<input type="hidden" name="opt" value="UpMap" />
    <a>
        <input type="hidden" name="type" value="<?php echo $map['cType']?>" />
        <input type="hidden" name="id" value="<?php echo $map['iId']?>" />
    	X<input type="text" name="xmap" id="latid" value="<?php echo $map['fX']?>" readonly=""/>
    	Y<input type="text" name="ymap" id="lonid" value="<?php echo $map['fY']?>" readonly=""/>
    	Zoom<input type="text" name="zoommap" id="zoomid" value="<?php echo $map['iZoom']?>" size="2"/>
        Text<input type="text" name="textmap" value="<?php echo $map['cName']?>" id="textid"/>
        <input type="submit" value="Ok"  />
    </a>
</form>
</div>

<script type="text/javascript">
<?php
if(!empty($alert))
{
    echo 'alert("'.$alert.'");';
}
?>
	var img = new Image();
	var hasMoved = 0;
    var map = new GMap2(document.getElementById("map"));

    map.addControl(new GSmallMapControl());
    map.addControl(new GMapTypeControl());
    var pointlat = <?php echo $map['fX']?>;
    var pointlng = <?php echo $map['fY']?>;
    var pointzoom = <?php echo $map['iZoom']?>;

    map.setCenter(new GLatLng(pointlat, pointlng), pointzoom);

	GEvent.addListener(map, "zoom", function() {
		SwapGeoLabel();
    	});
	GEvent.addListener(map, "moveend", function() {
		if(hasMoved==0){
			SwapGeoLabel();
		}
	});
	function SwapGeoLabel(){
		var point = map.getCenter();
		pointlat = point.lat();
		pointlng = point.lng();
		pointzoom = map.getZoom();
		document.getElementById('lonid').value =  pointlng;
		document.getElementById('latid').value = pointlat;
		document.getElementById('zoomid').value = pointzoom;
	};
    function getId(id)
    {
        return document.getElementById(id);
    }
    function checkForm()
    {
        var xx=getId('latid').value;
        var yy=getId('lonid').value;
        var zo=getId("zoomid").value;
        var tt=getId("textid").value;
        if(xx=="" || yy=="")
        {
            alert("Please select Postion");
            return false;
        }
        if(tt=="")
        {
            alert("Please enter Text");
            getId("textid").focus();
            return false;
        }
    }
</script>
</body></html>